<?php
namespace app\admin\controller;

use app\admin\logic\ServerLogic;
use think\Request;

class Server extends Base{
	private $serverLogic;
	public function __construct( Request $request = null ) {
		parent::__construct( $request );
		$this->serverLogic=new ServerLogic();
	}

	// 列表页
	public function index(){
		$servers=$this->serverLogic->query('');
		$this->assign('list',$servers);
		return $this->fetch();
	}

	//新增用户页面
	public function add($id=0){
		$server=null;
		if($id>0){
			$server=$this->serverLogic->findOne($id);
		}
		$this->assign('server',$server);
		return $this->fetch();
	}

	//保存数据
	public function doAdd($param=''){
		$userArr=json_decode($param,true);
		$res=$this->serverLogic->add($userArr);
		return $res;
	}

	//删除数据
	public function del($id=0){
		$res=$this->serverLogic->del($id);
		return $res;
	}


	// 维修技师打开服务页面
	public function indexServer(){
		return $this->fetch();
	}

	// 服务项目
	public function getServerItems($id=0){
		return $this->serverLogic->getServerItems($id);
	}

}




